package cn.tedu.net.collection.basic;

import java.util.Arrays;

public class Test3_Array {
    public static void main(String[] args) {
        int[] a=new int[6];
        System.out.println(a);//  哈希值 [I@  十六进制 1b6d3586
        char[] b = new char[5];
        System.out.println(b);//地址值[I@4554617c
        //静态初始化
        int[] i =new int[]{1,2,3,4,6};
        int[] j={1,2,3,4,5,6};
        //动态初始化
        int[] c=new int[5];
        //创建静态数组
        char[] ch1 ={'h','e','l','l','o'};
        char[] ch2 =new char[]{'h','e','l','l','o'};
        //动态创建--先定义长度
        char[] ch3 =new char[5];//  /u0000
        ch3[0] ='h'; ch3[1] ='e'; ch3[2] ='l'; ch3[3] ='l'; ch3[4] ='o';
        //创建String的数组s   a,b,c
        String[] s= {"a","b","c"};
        //数组内容打印
        System.out.println(Arrays.toString(b));
        System.out.println(Arrays.toString(i));
        System.out.println(Arrays.toString(j));
        System.out.println(Arrays.toString(s));
        System.out.println(Arrays.toString(ch1));
        System.out.println(Arrays.toString(ch2));
        System.out.println(Arrays.toString(ch3));
        //查看数组的长度
        System.out.println(ch3.length);
        int[][] x={{1,2},{0},{1,2,3}};//则a[1][0]的值为
        System.out.println(x[1][0]);

        System.out.println(Arrays.toString(array(1,2,3)));
        Test5_Bubble ax =new Test5_Bubble();
        ax.a=20;

    }
    public static int[] array(int... a){
        return a;
    }

}
